import os
import openai_prompt
import langchain
from langchain.llms import OpenAI

class OpenAIClient():
    def __init__(self):
        self.llmClient = OpenAI( temperature=0.5,openai_api_key=os.environ.get('OPENAI_API_KEY'),base_url='https://api.chatanywhere.tech/v1')
        print(self.llmClient)
    # 获取城市有什么好吃的
    # param: city 城市名称
    # return: 城市好吃的描述
    def getCityGoodEat(self, city: str) -> str:
        # 创建模版
        promptObj = openai_prompt.OpenAIPPrompt()
        # 构建链
        llmChains = LLMChain(llm=self.llmClient,prompt=promptObj)
        llmChains.run(city='广州')
